/**
 * 
 */
package com.google.code.cisx.converters;

import org.apache.commons.beanutils.Converter;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import java.lang.reflect.TypeVariable;
import java.util.List;

/**
 * Converts {@link List}s.
 * 
 * @author <a href='mailto:rahul.thakur.xdev@gmail.com'>Rahul Thakur</a>
 * @since 1.0
 * @version $Id: ListConverter.java 258 2008-11-29 06:23:51Z rahul.thakur.xdev $
 */
public class ListConverter implements Converter {

  /**
   * Commons Logging.
   */
  private static final Log log = LogFactory.getLog(ListConverter.class);

  /**
   * {@inheritDoc}
   * 
   * @see org.apache.commons.beanutils.Converter#convert(java.lang.Class,
   *      java.lang.Object)
   */
  public Object convert(Class type, Object value) {
    // TODO Auto-generated method stub
    if (type == List.class) {
      TypeVariable<?>[] parameters = value.getClass().getTypeParameters();

      if (log.isDebugEnabled() && null != parameters && parameters.length > 0) {
        log.debug("Found " + parameters.length + " for the list");
      }

    }

    return null;
  }
}
